package jdwl.hrmgrsys.service.sys;

import java.util.LinkedHashMap;
import java.util.List;

import javax.annotation.Resource;

import jdwl.hrmgrsys.dao.sys.SysParamDao;
import jdwl.hrmgrsys.pojo.core.ParaType;
import jdwl.hrmgrsys.pojo.core.SystemPara;
import jdwl.hrmgrsys.pojo.core.SystemParaType;

import org.springframework.stereotype.Service;

import com.ssh.core.QueryResult;
import com.ssh.service.CRUDService;
@Service
public class SysParamService  extends CRUDService<SystemPara> {
	@Resource
	private SysParamDao dao;
	
	public QueryResult<SystemPara> listParas(int pageNo,int pageSize,List<String> whereClause,LinkedHashMap<String, String> paramMap, LinkedHashMap<String, String> orderbyClause) {
		return getDao().findScrollData(SystemPara.class,pageNo, pageSize,whereClause,paramMap,orderbyClause);
	}
	public List<SystemPara> querySystemParas(String propertyName, Object value) {
		return getDao().findByProperty(SystemPara.class, propertyName, value);
	}
	public List<SystemPara> querySystemParasByType(String typeCode) {
		return getDao().queryParasByType(typeCode);
	}

	
	public QueryResult<SystemParaType> listParaTypes(int pageNo,int pageSize,List<String> whereClause,LinkedHashMap<String, String> paramMap, LinkedHashMap<String, String> orderbyClause) {
		return getDao().findScrollData(SystemParaType.class,pageNo, pageSize,whereClause,paramMap,orderbyClause);
	}
	public List<SystemParaType> queryParaTypes(){
		List<SystemParaType> types = getDao().findAll(SystemParaType.class);
		return types;
	}
	public SysParamDao getDao() {
		return dao;
	}
	public void setDao(SysParamDao dao) {
		this.dao = dao;
	}
	public void addParam(SystemPara param) {
		dao.getHibernateTemplate().saveOrUpdate(param);
	}
	public void addParamType(SystemParaType type) {
		dao.getHibernateTemplate().save(type);
	}
}
